<xsl:stylesheet
  version="1.0"
  exclude-result-prefixes="x d xsl msxsl cmswrt"
  xmlns:x="http://www.w3.org/2001/XMLSchema"
  xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
  xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

  <xsl:template name="Default" match="*" mode="itemstyle">
    Please select a specific template.
  </xsl:template>

  <xsl:template name="AmGridviewItem" match="Row[@Style='AmGridviewItem']" mode="itemstyle">
    <xsl:variable name="Image">
      <xsl:value-of select="substring-before(@PodcastThumbnail, ',')" />
    </xsl:variable>
    <xsl:variable name="Title">
      <xsl:value-of select="@Title" />
    </xsl:variable>
    <xsl:variable name="SafeLinkUrl">
      <xsl:value-of select="concat(string('/Pages/PodcastDetail.aspx?pid='), @ID)" />
    </xsl:variable>
    <xsl:variable name="Desc">
      <xsl:variable name="Desc1">
        <xsl:call-template name="OuterTemplate.Replace">
          <xsl:with-param name="Value" select="@Description"/>
          <xsl:with-param name="Search" select="string('&lt;div&gt;')"/>
          <xsl:with-param name="Replace" select="string('')"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:call-template name="OuterTemplate.Replace">
        <xsl:with-param name="Value" select="$Desc1"/>
        <xsl:with-param name="Search" select="string('&lt;/div&gt;')"/>
        <xsl:with-param name="Replace" select="string('')"/>
      </xsl:call-template>
    </xsl:variable>

    <div>
      <a href="{$SafeLinkUrl}">
        <img src="{$Image}" width="120px" alt="{$Desc}" />
      </a>
    </div>
    <div class="am-griditem-desc">
      <table>
        <tr>
          <td valign="middle" height="40px">
            <a class="am-desclink" href="{$SafeLinkUrl}">
              <xsl:choose>
                <xsl:when test="string-length($Title) > 50">
                  <xsl:value-of select="substring($Title, 1, 47)" />
                  <xsl:value-of select="'...'" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="$Title" />
                </xsl:otherwise>
              </xsl:choose>
            </a>
          </td>
        </tr>
      </table>
    </div>
    <div>
      <img src="/Style Library/AMAccelerator/Images/star_gray.gif" alt="Rating" />
      <img src="/Style Library/AMAccelerator/Images/star_gray.gif" alt="Rating" />
      <img src="/Style Library/AMAccelerator/Images/star_gray.gif" alt="Rating" />
      <img src="/Style Library/AMAccelerator/Images/star_gray.gif" alt="Rating" />
      <img src="/Style Library/AMAccelerator/Images/star_gray.gif" alt="Rating" />
    </div>
    <div class="am-griditem-user">
      <table>
        <tr>
          <td valign="top" width="40px">
            <xsl:value-of select="string('By ')" />
          </td>
          <td valign="top" style="font-size:10px;">
            <xsl:call-template name="OuterTemplate.GetSafeUserLink">
              <xsl:with-param name="SharePointUser" select="@PodcastAuthor" />
            </xsl:call-template>
          </td>
        </tr>
      </table>
    </div>
    <div>
      <div>
        <xsl:value-of select="@Format" /> (<xsl:value-of select="@PodcastLanguage"/>)
      </div>
      <div>
        <xsl:value-of select="string('Pub: ')" />
        <xsl:call-template name="OuterTemplate.FormatDate">
          <xsl:with-param name="DateTime" select="@PodcastPublishDate" />
        </xsl:call-template>
      </div>
      <div>
        <xsl:value-of select="@PodcastDuration" />
      </div>
    </div>
    <div>
      <table width="100%">
        <tr>
          <td style="width:33%;text-align:left">
            <input type="checkbox" />
          </td>
          <td style="width:33%;text-align:left">
            <img src="/Style Library/AMAccelerator/Images/thumb_68.gif" />0
          </td>
          <td style="width:33%;text-align:left">
            <img src="/Style Library/AMAccelerator/Images/thumb_70.gif" />0
          </td>
        </tr>
      </table>
    </div>

  </xsl:template>

</xsl:stylesheet>
